﻿using System;
using System.Security.Principal;

namespace Practical.SharePoint.Base
{
    public static class StringHelpers
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Identifer")]
        public static string GetSecurityIdentiferString(Byte[] securityIdentifer)
        {
            if (securityIdentifer == null)
            {
                throw new ArgumentNullException("securityIdentifer");
            }
            
            SecurityIdentifier sid = new SecurityIdentifier(securityIdentifer, 0);
            return sid.ToString();
        }
    }
}
